package com.rp.prize.commons.db.mapper;

import com.rp.prize.commons.db.entity.JobStatusTraceLog;
import com.rp.prize.commons.db.entity.JobStatusTraceLogExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface JobStatusTraceLogMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    long countByExample(JobStatusTraceLogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    int deleteByExample(JobStatusTraceLogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    @Delete({
        "delete from JOB_STATUS_TRACE_LOG",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    @Insert({
        "insert into JOB_STATUS_TRACE_LOG (job_name, original_task_id, ",
        "task_id, slave_id, ",
        "source, execution_type, ",
        "sharding_item, state, ",
        "message, creation_time)",
        "values (#{jobName,jdbcType=VARCHAR}, #{originalTaskId,jdbcType=VARCHAR}, ",
        "#{taskId,jdbcType=VARCHAR}, #{slaveId,jdbcType=VARCHAR}, ",
        "#{source,jdbcType=VARCHAR}, #{executionType,jdbcType=VARCHAR}, ",
        "#{shardingItem,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, ",
        "#{message,jdbcType=VARCHAR}, #{creationTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=String.class)
    int insert(JobStatusTraceLog record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    int insertSelective(JobStatusTraceLog record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    List<JobStatusTraceLog> selectByExample(JobStatusTraceLogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, job_name, original_task_id, task_id, slave_id, source, execution_type, sharding_item, ",
        "state, message, creation_time",
        "from JOB_STATUS_TRACE_LOG",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @ResultMap("com.rp.prize.commons.db.mapper.JobStatusTraceLogMapper.BaseResultMap")
    JobStatusTraceLog selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") JobStatusTraceLog record, @Param("example") JobStatusTraceLogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") JobStatusTraceLog record, @Param("example") JobStatusTraceLogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(JobStatusTraceLog record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table JOB_STATUS_TRACE_LOG
     *
     * @mbg.generated
     */
    @Update({
        "update JOB_STATUS_TRACE_LOG",
        "set job_name = #{jobName,jdbcType=VARCHAR},",
          "original_task_id = #{originalTaskId,jdbcType=VARCHAR},",
          "task_id = #{taskId,jdbcType=VARCHAR},",
          "slave_id = #{slaveId,jdbcType=VARCHAR},",
          "source = #{source,jdbcType=VARCHAR},",
          "execution_type = #{executionType,jdbcType=VARCHAR},",
          "sharding_item = #{shardingItem,jdbcType=VARCHAR},",
          "state = #{state,jdbcType=VARCHAR},",
          "message = #{message,jdbcType=VARCHAR},",
          "creation_time = #{creationTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(JobStatusTraceLog record);
}